<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //5. 检测是否是本地电话，如010-12345678,0418-12345678
    //题目需求不明确 判断本地电话不应该是看区号是不是固定为当地的 但例子又举了两个区号不一样的
    //假设要求区号必须010
    let reg = /^010-\d{8}$/;
    console.log(reg.test("123"));
    console.log(reg.test("12345678"));
    console.log(reg.test("010-12345678"));
    console.log(reg.test("021-12345678"));
  </script>
</body>
</html>